package com.lambdademo.lambdatest;

import lombok.extern.slf4j.Slf4j;

import java.util.function.Function;
import java.util.function.IntPredicate;

@Slf4j
public class LambdaDemo1 {
    public static void main(String[] args) {
        int i = typeConvert(Integer::parseInt);
        log.info("i:{}", i);
        log.info("i:{}",i+1.1);
    }

    public static void printNum(IntPredicate predicate){
        int[] nums = {1,2,3,4,5,6,7,8,9,10};
        for (int num : nums) {
            if(predicate.test(num)){
                log.info("num:{}",num);
            }
        }
    }

    public static <R> R typeConvert(Function<String,R> function){
        String str = "123";
        return function.apply(str);
    }
}
